package org.graduation.recruitment.entity.enums;

import jakarta.annotation.Nullable;

import java.util.Map;

public enum JobType {
    FULL_TIME("全职"),
    PART_TIME("兼职"),
    INTERNSHIP("实习");
    private final String value;

    JobType(String value) {
        this.value = value;
    }

    @Nullable
    public static JobType of(String value) {
        for (JobType jobType : JobType.values()) {
            if (jobType.getValue().equals(value)) {
                return jobType;
            }
        }
        return null;
    }

    public static Map<JobType, String> toMap() {
        return Map.of(
                JobType.FULL_TIME, JobType.FULL_TIME.toString(),
                JobType.PART_TIME, JobType.PART_TIME.toString(),
                JobType.INTERNSHIP, JobType.INTERNSHIP.toString()
        );
    }

    public String getValue() {
        return value;
    }

    public String toString() {
        return getValue();
    }
}